package com.avery.imp;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.avery.dao.ICityDao;
import com.avery.entity.City;

public class CityDaoImp extends SqlSessionDaoSupport implements ICityDao {


	public void insert(City city) {
		getSqlSession().insert("com.avery.entity.City.insert", city);
	}

	public List<City> getAllCity() {
		List<City> cityList = getSqlSession().selectList("com.avery.entity.City.selectAll");
		return cityList;
	}

	public int getCityIDByName(String name) {
		City city = getSqlSession().selectOne("com.avery.entity.City.getByName",name);
		return city.getId();
	}

	public List<City> getAllCityByProvinceID(int provinceID) {
		List<City> cityList = getSqlSession().selectList("com.avery.entity.City.getByProvinceID",provinceID);
		return cityList;
	}

}
